import {request, writeLog} from "../libs/core.js"
export default {
  namespaced: true,  //多出的一行
  state: {
  	user: {},
    module: []
  },
  mutations: {
    initSet(state, datas) {
		  for (let keys in datas) {
		    state[keys] = datas[keys];
		  }
		}
  },
  getters: {
  	user: state => {
  		return state.user;
  	}
  },
  actions: {
		async loadModule(context) {
		  try {
				const data = await request({url:'/module', method:'post'});
				context.commit("initSet", {module:data.module});
		  } catch(e) {
				writeLog(0, e);
		  }
    	return false;
		}
  }
}